package com.wnhz.work.yz.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.wnhz.work.yz.R;
import com.wnhz.work.yz.bean.ChooseKindBean;

import java.util.List;

/**
 * Created by admin on 2016/12/27.
 */
public class ChooseKindAdapter extends BaseAdapter {
    private Context context;
    private List<ChooseKindBean> beanList;

    public ChooseKindAdapter(Context context, List<ChooseKindBean> beanList) {
        this.context = context;
        this.beanList = beanList;
    }

    @Override
    public int getCount() {
        return beanList.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ChooseKindViewHolder viewHolder = new ChooseKindViewHolder();
        if (convertView == null) {
            convertView = LayoutInflater.from(context).inflate(R.layout.choose_kind_item, null);
            viewHolder.tv_kind_name = (TextView) convertView.findViewById(R.id.tv_kind_name);

            convertView.setTag(viewHolder);
        } else {
            viewHolder = (ChooseKindViewHolder) convertView.getTag();
        }

        viewHolder.tv_kind_name.setText(beanList.get(position).getName());

        return convertView;
    }

    class ChooseKindViewHolder {
        TextView tv_kind_name;
    }

}
